home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / X11 / wais / waisgate / wmessage.h < prev    next >
C/C++ Source or Header  |  1995-05-09  |  2KB  |  76 lines

  1. /* WIDE AREA INFORMATION SERVER SOFTWARE
  2.    No guarantees or restrictions.  See the readme file for the full standard
  3.    disclaimer.    
  4.    3.26.90
  5. */
  6.  
  7. /* wais-message.h
  8.  *
  9.  * This is the header outside of WAIS Z39.50 messages.  The header will be
  10.  * printable ascii, so as to be transportable.  This header will precede each
  11.  * Z39.50 APDU, or zero-length message if it is an ACK or NACK.  Be sure to
  12.  * change hdr_vers current value if you change the structure of the header.
  13.  *
  14.  * The characters in the header are case insensitive so that the systems from
  15.  * the past that only handle one case can at least read the header.
  16.  *
  17.  * 7.5.90 HWM - added constants
  18.  * 7/5/90 brewster added funtion prototypes and comments
  19.  * 11/30/90 HWM - went to version 2 (inits and typed retrieval)
  20.  */
  21.  
  22. #ifndef WMESSAGE_H
  23. #define WMESSAGE_H
  24.  
  25. #include "cdialect.h"
  26.  
  27. typedef struct wais_header {
  28.         char    msg_len[10];    /* length in bytes of following message */
  29.         char    msg_type;       /* type of message: 'z'=Z39.50 APDU,
  30.                                    'a'=ACK, 'n'=NACK */
  31.         char    hdr_vers;       /* version of this header, currently = '2' */
  32.         char    server[10];     /* name or address of server */
  33.         char    compression;    /* <sp>=no compression, 'u'=unix compress */
  34.         char    encoding;       /* <sp>=no encoding, 'h'=hexize, 
  35.                    'u'=uuencode */
  36.         char    msg_checksum;   /* XOR of every byte of message */
  37.         } WAISMessage;
  38.  
  39. #define HEADER_LENGTH     25    /* number of bytes needed to write a 
  40.                    wais-header (not sizeof(wais_header)) */
  41.  
  42. #define HEADER_VERSION     (long)'2'
  43.  
  44. /* message type */
  45. #define Z3950        'z'  
  46. #define ACK            'a'  
  47. #define    NAK            'n'  
  48.  
  49. /* compression */
  50. #define NO_COMPRESSION         ' ' 
  51. #define UNIX_COMPRESSION     'u' 
  52.  
  53. /* encoding */
  54. #define NO_ENCODING        ' '  
  55. #define HEX_ENCODING    'h'  /* Swartz 4/3 encoding */
  56. #define IBM_HEXCODING    'i'     /* same as h but uses characters acceptable for IBM mainframes */
  57. #define UUENCODE        'u'  
  58.  
  59. #ifdef __cplusplus
  60. /* declare these as C style functions */
  61. extern "C"
  62.     {
  63. #endif /* def __cplusplus */
  64.  
  65. void readWAISPacketHeader _AP((char* msgBuffer,WAISMessage *header_struct));
  66. long getWAISPacketLength _AP((WAISMessage* header));
  67. void writeWAISPacketHeader _AP((char* header,long dataLen,long type,
  68.                 char* server,long compression,    
  69.                 long encoding,long version));
  70.  
  71. #ifdef __cplusplus
  72.     }
  73. #endif /* def __cplusplus */
  74.  
  75. #endif /* ndef WMESSAGE_H */
  76.